package at.fhooe.engine.mapobject;

import at.fhooe.engine.event.events.CollisionEvent;
import at.fhooe.engine.pandora.Game;
import at.fhooe.engine.pathfinding.BalancingPf;
import at.fhooe.engine.physics.CircleBody;
import at.fhooe.engine.physics.PhysicBody;
import at.fhooe.engine.physics.SquareBody;

public class Wall extends MapObject implements CollisionEvent.Listener {

	public static final String ID = "Map_Wall";

	private PhysicBody m_physicBody;
	private double m_size;

	public Wall(String entityId, String name, double positionX,
			double positionY, double positionZ) {
		super(entityId, name, positionX, positionY, BalancingPf.BAL_WALLSIZE);
		m_size = BalancingPf.BAL_WALLSIZE;

		m_physicBody = new SquareBody(name, m_size, m_size, false);
		m_physicBody.setPosition(positionX, positionY, positionZ);
		m_physicBody.setVelocity(0, 0, 0);
	}

	@Override
	public void onCollisionEvent(CollisionEvent collisionEvent) {
		// TODO Auto-generated method stub

	}

	@Override
	protected void initialize() {
		Game.getInstance().getPhysicsManager().addPhysicBody(m_physicBody);
		Game.getInstance().getEventManager()
				.addListener(this, CollisionEvent.TYPE);
	}

	@Override
	protected void deinitialize() {
		Game.getInstance().getPhysicsManager().removePhysicBody(m_physicBody);
		Game.getInstance().getEventManager()
				.removeListener(this, CollisionEvent.TYPE);
	}

	@Override
	public void update() {
		// TODO Auto-generated method stub

	}

	public double getPositionX() {
		return m_physicBody.getPositionX();
	}

	public double getPositionY() {
		return m_physicBody.getPositionY();
	}
	
	public PhysicBody getPhysicBody(){
		return m_physicBody;
	}

	public double getSize() {
		// TODO Auto-generated method stub
		return m_size;
	}
}
